package main.kotlin.solution

class TwoSum {

    fun twoSum(nums: IntArray, target: Int): IntArray {
        var i = 0
        var j = nums.size-1
        while(i<j){
            val res = nums[i]+nums[j]

            if (res > target ){
                j--
            }else if(res == target){
                return intArrayOf( nums[i],nums[j])
            }else{
                i++
            }
        }
        return intArrayOf(0,0)
    }
}